<template>
	<div>
		<form @submit.prevent>
			<List header="客户小程序" border item-layout="vertical">
				<ListItem>
					<ListItemMeta title="客户小程序appid" />
					<template #action>
						<li style="width: 100%;">
				  	<Input v-model="setting.cappid" placeholder="请输入客户小程序appid" />
						</li>
					</template>
				</ListItem>
				<ListItem>
					<ListItemMeta title="客户小程序secretkey" />
					<template #action>
						<li style="width: 100%;">
							<Input v-model="setting.csecretkey" placeholder="请输入客户小程序secretkey" />
						</li>
					</template>
				</ListItem>
			</List>

			<List header="教练小程序" border item-layout="vertical">
				<ListItem>
					<ListItemMeta title="教练小程序appid" />
					<template #action>
						<li style="width: 100%;">
							<Input v-model="setting.jappid" placeholder="请输入教练小程序appid" />
						</li>
					</template>
				</ListItem>
				<ListItem>
					<ListItemMeta title="教练小程序secretkey" />
					<template #action>
						<li style="width: 100%;">
							<Input v-model="setting.jsecretkey" placeholder="请输入教练小程序secretkey" />
						</li>
					</template>
				</ListItem>
			</List>


			<List header="店长小程序" border item-layout="vertical">
				<ListItem>
					<ListItemMeta title="店长小程序appid" />
					<template #action>
						<li style="width: 100%;">
							<Input v-model="setting.dappid" placeholder="请输入店长小程序appid" />
						</li>
					</template>
		 	</ListItem>
				<ListItem>
					<ListItemMeta title="店长小程序secretkey" />
					<template #action>
						<li style="width: 100%;">
							<Input v-model="setting.dsecretkey" placeholder="请输入店长小程序secretkey" />
						</li>
					</template>
				</ListItem>
			</List>
			<div class="button-container right">
				<Button @click="saveXcxxx">保存</Button>
			</div>
		</form>
	</div>
</template>
<script>
	export default {
		data() {
			return {
				setting: {
					cappid: null,
					csecretkey: null,
					jappid: null,
					jsecretkey: null,
					dappid: null,
					dsecretkey: null,
				},
			}
		},

		methods: {
			saveXcxxx() {
				this.http.post({
					url: "/settings/xtsz/info",
					data: this.setting,
				}).then(response => {
					if (response.saveMsg) {
						this.message.info("保存成功");
					}
				});
			}
		},
		created() {
			this.http.get({
					url: "/settings/xtsz",
				})
				.then(data => {
					this.setting = data.xtsz;
				})

		},

	}
</script>
